﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twodi.Implemented;
using Microsoft.Xna.Framework;
using Twodi.Input;

namespace Mono2D.Components
{
    class Cursor : Animated
    {
        public Cursor(Microsoft.Xna.Framework.Game game)
            : base("Cursor", game)
        {
            AnimationBehavior.Create("Cursor",
                AnimationType.Normal_Loop,
                new AnimationFrame(0, 0, 15, 16),
                new AnimationFrame(15, 0, 15, 16),
                new AnimationFrame(0, 16, 15, 16),
                new AnimationFrame(15, 16, 15, 16));

            AnimationBehavior.Animation = "Cursor";

            AnimationBehavior.Animations["Cursor"].Finished += (sender, e) =>
            {
                AnimationBehavior.Animations["Cursor"].Enabled = false;
            };
        }

        public override void Update(GameTime gameTime)
        {
            Position = GlobalInput.Mouse.Position;
            base.Update(gameTime);
        }
    }
}
